<?php
class Controller_Admin_Base extends Controller_Base {
	
	protected $showLeftColumn = true;
	
	public function action() {
		$this->addJs('photo.js');
		$this->addCss('photo.css');
		
		if (User_User::isAdmin()) $this->actionSwitch();
		else $this->actionAuth();
	}
	
	protected function actionSwitch() {
		$this->pageHead = $this->title = 'Панель администратора';
		
		$this->showHeader();
			echo '<p class="text">Вы вошли в панель администратора сайта 101tours.ru</p>';
		$this->showFooter();
	}
	
	protected function actionAuth() {
		if (isset($_POST['login']) && isset($_POST['pass'])) {
			if ($_POST['login'] === 'admin' && $_POST['pass'] === 'hotelS1234') {
				setcookie('hash', 'huia9KK8998jJD9jgh934mvKKKdas2masdlsdm34', time() + 9999999, '/', '.' . SITE);
				User_Location::move(W_ADMIN);
			}
		}
		
		$this->showLeftColumn = false;
		$this->pageHead = $this->title = 'Авторизация';
		
		$this->showHeader();
			View_AdminBlock::showAuthForm();
		$this->showFooter();
	}
	
	protected function showTop() {
		View_Block::showHeader();
	}
	
	protected function showAnalytics() {}
	
}